package com.study.ctripapollo.service;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * @author flwu
 * @date 2020/3/16 4:16 PM
 * @MOTTO 保持空和敬畏
 */
@Service
public class ApolloService {

    @Value("${name}")
    private String name;

    @ApolloConfig
    private Config config;

    public String getKey() {
        return name;
    }

    public String getName(String name) {
        return config.getProperty(name, "defaultName");
    }

}
